package cn.stylefeng.guns.modular.weixin.api;

import cn.stylefeng.guns.modular.weixin.entity.ClassCofig;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class Utils {


    public  static List  Way(Object obj){
        Class cls = obj.getClass();
        Field[] fields = cls.getDeclaredFields();
        List<ClassCofig> list =new ArrayList<>();
        for(int i=0;i<fields.length;i++){
            Field f = fields[i];
            f.setAccessible(true);//设置属性可读
            try {
                list.add(new ClassCofig(f.getName(),f.get(obj)));
                System.out.println("host["+f.getName()+"] =  "+f.get(obj));
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return  list;
    }

}
